package Chapter3;

class Human{
	private String name;
	private int age;
	public String getName() {
		return name;
	}
	public void setName(String stuName) {
		name=stuName;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int stuAge) {
		if(stuAge<=0) {
			System.out.println("Age is illegal.");
		}else {
			age=stuAge;
		}
	}
	public void introduce() {
		System.out.println("Hello everybody, this is "+name+" speaking and I am "+age+" !");
	}
}

public class Example04 {
	public static void main(String[] args) {
		Human stu=new Human();
		stu.setAge(10);
		stu.setName("lifang");
		stu.introduce();
	}

}
